(echo -n "internal_styles.c: mkstyle.sh " ; echo style/*.style ; /bin/echo -e '\t./mkstyle.sh > $@ || (rm -f $@ ; exit 1)' ) >> /tmp/dep
echo Edit Makefile and bring in /tmp/dep
-VERSIONU=1_2_2_beta0317a2004
-VERSIOND=1.2.2_beta0317a2004
-VERSIONU=1_2_2
-VERSIOND=1.2.2
+VERSIONU=1_2_3_beta04052004
+VERSIOND=1.2.3_beta04052004
+#VERSIONU=1_2_2
+#VERSIOND=1.2.2
release:
cvs commit
}
opdb->name[PDB_DBNAMELEN-1] = 0;
opdb->attributes = PDB_ATTR_BACKUP;
- opdb->ctime = opdb->mtime = time(NULL) + 2082844800U;
+ opdb->ctime = opdb->mtime = current_time() + 2082844800U;
opdb->type = MYTYPE; /* CWpt */
opdb->creator = MYCREATOR; /* cGPS */
opdb->version = 1;
strncpy(opdb->name, out_fname, PDB_DBNAMELEN);
opdb->name[PDB_DBNAMELEN-1] = 0;
opdb->attributes = PDB_ATTR_BACKUP;
- opdb->ctime = opdb->mtime = time(NULL) + 2082844800U;
+ opdb->ctime = opdb->mtime = current_time() + 2082844800U;
opdb->type = MYTYPE;
opdb->creator = MYCREATOR;
opdb->version = 0;
char *strsub(char *s, char *search, char *replace);
void rtrim(char *s);
signed int get_tz_offset(void);
+time_t current_time(void);
signed int month_lookup(const char *m);
const char *get_cache_icon(const waypoint *waypointp);
char * xml_entitize(const char * str);
strncpy(opdb->name, "GeocachingDB", PDB_DBNAMELEN);
opdb->name[PDB_DBNAMELEN-1] = 0;
opdb->attributes = PDB_ATTR_BACKUP;
- opdb->ctime = opdb->mtime = time(NULL) + 2082844800U;
+ opdb->ctime = opdb->mtime = current_time() + 2082844800U;
opdb->type = MYTYPE; /* CWpt */
opdb->creator = MYCREATOR; /* cGPS */
opdb->version = 1;
PdbOut->name[PDB_DBNAMELEN-1] = 0;
PdbOut->attributes = PDB_ATTR_BACKUP;
- PdbOut->ctime = PdbOut->mtime = time(NULL) + (49*365 + 17*366) * (60*60*24);
+ PdbOut->ctime = PdbOut->mtime = current_time() + (49*365 + 17*366) * (60*60*24);
PdbOut->type = MYTYPE;
PdbOut->creator = MYCREATOR;
PdbOut->version = 0;
*/
opdb->name[PDB_DBNAMELEN-1] = 0;
opdb->attributes = PDB_ATTR_BACKUP;
- opdb->ctime = opdb->mtime = time(NULL) + 2082844800U;
+ opdb->ctime = opdb->mtime = current_time() + 2082844800U;
opdb->type = MYWPT;
opdb->creator = MYCREATOR;
* Make sure that all waypoints in single read have same
* timestamp.
*/
- time_t now = time(NULL);
+ time_t now = current_time();
do {
linecount++;
}
opdb->name[PDB_DBNAMELEN-1] = 0;
opdb->attributes = PDB_ATTR_BACKUP;
- opdb->ctime = opdb->mtime = time(NULL) + 2082844800U;
+ opdb->ctime = opdb->mtime = current_time() + 2082844800U;
opdb->type = MYTYPE_POINTS;
opdb->creator = MYCREATOR;
opdb->version = 0;
* Make sure that all waypoints in single read have same
* timestamp.
*/
- time_t now = time(NULL);
+ time_t now = current_time();
for(;fgets(ibuf, sizeof(ibuf), file_in);) {
int short_length;
bounds bounds;
- time( &now );
+ now = current_time();
if (snlen)
short_length = atoi(snlen);
tm = gmtime( &wpt->creation_time);
}
if ( !tm ) {
- time( &tm_t );
+ tm_t = current_time();
tm = gmtime( &tm_t );
}
strncpy(opdb->name, "Companion Waypoints", PDB_DBNAMELEN);
opdb->name[PDB_DBNAMELEN-1] = 0;
opdb->attributes = PDB_ATTR_BACKUP;
- opdb->ctime = opdb->mtime = time(NULL) + 2082844800U;
+ opdb->ctime = opdb->mtime = current_time() + 2082844800U;
opdb->type = MYTYPE; /* CWpt */
opdb->creator = MYCREATOR; /* cGPS */
opdb->version = 1;
if (!noack)
mag_handon();
- now = time(NULL);
+ now = current_time();
/*
* The 315 can take up to 4.25 seconds to respond to initialization
* commands. Time out on the side of caution.
while (!got_version) {
mag_readmsg();
- if (time(NULL) > later) {
+ if (current_time() > later) {
fatal(MYNAME ": No acknowledgment from GPS on %s\n",
portname);
}
tm = gmtime( &wpt->creation_time);
}
if ( !tm ) {
- time( &tm_t );
+ tm_t = current_time();
tm = gmtime( &tm_t );
}
strncpy(opdb->name, "Companion Waypoints", PDB_DBNAMELEN);
opdb->name[PDB_DBNAMELEN-1] = 0;
opdb->attributes = PDB_ATTR_BACKUP;
- opdb->ctime = opdb->mtime = time(NULL) + 2082844800U;
+ opdb->ctime = opdb->mtime = current_time() + 2082844800U;
opdb->type = MYTYPE; /* CWpt */
opdb->creator = MYCREATOR; /* cGPS */
opdb->version = 1;
}
else {
fclose(mps_file_out);
- srand((unsigned) time(NULL));
+ srand((unsigned) current_time());
for (;;) {
/* create a temporary name based on a random char and the existing name */
}
if (uniqueValue == 0) {
- uniqueValue = time(NULL);
+ uniqueValue = current_time();
}
/* route name */
}
if (uniqueValue == 0) {
- uniqueValue = time(NULL);
+ uniqueValue = current_time();
}
/* track name */
hms = hms / 100;
tm.tm_hour = hms % 100;
- waypt->creation_time = mktime(&tm) + get_tz_offset() + time(0);
+ waypt->creation_time = mktime(&tm) + get_tz_offset() + current_time();
if (latdir == 'S') latdeg = -latdeg;
waypt->latitude = ddmm2degrees(latdeg);
hms = hms / 100;
tm.tm_hour = (long) hms % 100;
- waypt->creation_time = mktime(&tm) + get_tz_offset() + time(NULL);
+ waypt->creation_time = mktime(&tm) + get_tz_offset() + current_time();
if (latdir == 'S') latdeg = -latdeg;
waypt->latitude = ddmm2degrees(latdeg);
lat = degrees2ddmm(wpt->latitude);
if (tm == 0)
- tm = time(NULL);
+ tm = current_time();
strftime(tbuf, sizeof(tbuf), "%d-%b-%y %I:%M:%S", localtime(&tm));
while (*tp) {
*tp = toupper(*tp);
}
if (uniqueValue == 0) {
- uniqueValue = time(NULL);
+ uniqueValue = current_time();
}
/* route name */
}
if (uniqueValue == 0) {
- uniqueValue = time(NULL);
+ uniqueValue = current_time();
}
/* track name */
}
opdb->name[PDB_DBNAMELEN-1] = 0;
opdb->attributes = PDB_ATTR_BACKUP;
- opdb->ctime = opdb->mtime = time(NULL) + 2082844800U;
+ opdb->ctime = opdb->mtime = current_time() + 2082844800U;
opdb->type = MYTYPE; /* CWpt */
opdb->creator = MYCREATOR; /* cGPS */
opdb->version = 1;
pin = wpt->icon_descr ? wpt->icon_descr : "";
else if (wpt->icon_descr && strstr(wpt->icon_descr, "-unfound"))
pin = unfoundmarker;
- else if (wpt->creation_time > time(0) - 3600 * 24 * thresh_days)
+ else if (wpt->creation_time > current_time() - 3600 * 24 * thresh_days)
pin = newmarker;
else
pin = oldmarker;
signed int
get_tz_offset(void)
{
- time_t now = time(0);
+ time_t now = current_time();
time_t later = mktime(gmtime(&now));
if (later == -1) {
}
}
+/*
+ * A wrapper for time(2) that allows us to "freeze" time for testing.
+ */
+time_t
+current_time(void)
+{
+ static char *frozen;
+
+ if (getenv("GPSBABEL_FREEZE_TIME")) {
+ return 0;
+ }
+
+ return time(NULL);
+}
+
/*
* Return the (zero based) month number of the year or -1 for failure.
*/